home *** CD-ROM | disk | FTP | other *** search
- /* NCRSCSIDriverPrivate.h */
- /*
- * NCRSCSIDriverPrivate.h
- * Copyright © 1994 Apple Computer Inc. All rights reserved.
- */
- /* .___________________________________________________________________________________.
- | This is a private interface file for the sample driver. It contains configuration |
- | parameters, driver-specific global definitions, and function prototypes. |
- | NCR chip specific information is in NCR53C825.h. |
- .___________________________________________________________________________________.
- */
-
- #ifndef __NCRSCSIDriverPrivate__
- #define __NCRSCSIDriverPrivate__
-
- #define kVersionMajor 1
- #define kVersionMinor 0
- #define kVersionStage beta /* Res only */
- #define kVersionStageLetter 'b'
- #define kVersionStageValue betaStage /* Beta */
- #define kVersionRevision 3
- /*
- * Define the longest I/O transfer that the driver can perform. This determines the size
- * of the physical mapping tables. (It's a define rather than an enum because it might
- * not fit into a C int).
- */
- #if 1
- #define kNCRDriverMaxTransfer (1024L * 1024L) /* One Megabyte */
- #else /* Test partial preparation */
- #define kNCRDriverMaxTransfer (4096L) /* 4 Kb for partial prep test */
- #endif
-
- #define USE_LOG_LIBRARY 1 /* Used for debugging */
- #define LOG_TRACE 0 /* Used for serious debugging */
- /*
- * Use MEM space until AAPL,addresses is available. AAPL,addresses is indeed
- * available, but I haven't tested I/O accesses.
- */
- #define USE_MEM_ACCESS 1 /* Algorithm Testing */
- /*
- * USE_LOG_LIBRARY is set non-zero to compile in debugging functions. It should be set
- * FALS during the final stages of software testing. If you compile under MPW, you would
- * probably use a value defined in the MakeFile.
- *
- * LOG_TRACE logs entrances to all significant functions.
- */
- #ifndef USE_LOG_LIBRARY
- #define USE_LOG_LIBRARY 0
- #endif
- #ifndef USE_MEM_ACCESS
- #define USE_MEM_ACCESS 1
- #endif
- #ifndef LOG_TRACE
- #define LOG_TRACE USE_LOG_LIBRARY
- #endif
-
- /*
- * TEST_DRIVER is set TRUE by the test function. When non-zero it blocks definition
- * of the driver's chip-access functions.
- */
- #ifndef TEST_DRIVER
- #define TEST_DRIVER 0
- #endif
- #ifndef FALSE
- #define TRUE 1
- #define FALSE 0
- #endif
-
- #define kCreatorType 'PSSD' /* Registered Creator Type */
- #define kDriverGlobalsPropertyName "DriverGlobals" /* -> GLOBAL area */
- #define kDriverFailurePropertyName "InitFailure" /* Gets status on init failure */
- #define ICON_Driver 128 /* File Bundle icon */
- #define BNDL_Resource 128
- /*
- * The driver name is defined in the public header
- */
-
- #define kAuditIdent (kCreatorType) /* Audit Gestalt Selector */
- #define kAuditEntries 256
-
- #ifndef REZ
- /*
- * For code segments only
- */
- /*
- * Note: Do not use pre-compiled headers as they have not been upgraded for
- * the PCI driver definitions.
- *
- * Note that we have expanded all #include files to pre-load all dependencies.
- * If you add #include files, be sure to all their precedent files are loaded
- * from the {CIncludes} folder that contains the current PCI headers. This will
- * be revised when the PCI-headers are merged into the common Universal Header
- * distribution.
- *
- * This must be changed when the PCI-specific headers are merged into the
- * standard distribution.
- */
-
- #include <ConditionalMacros.h>
- #if GENERATINGPOWERPC == 0
- << error: the following will not work >>
- #endif
- #include <Types.h>
- #include <MixedMode.h>
- #include <OSUtils.h>
- #include <Files.h>
- #include <QuickdrawText.h>
- #include <QuickDraw.h>
- #include <Events.h>
- #include <Errors.h>
- #include <Memory.h>
- #include <Menus.h>
- #include <Controls.h>
- #include <Windows.h>
- #include <TextEdit.h>
- #include <Dialogs.h>
- #include <MachineExceptions.h>
- #include <PCI.h>
- #include <Kernel.h>
- #include <NameRegistry.h>
- #include <CodeFragments.h>
- #include <Devices.h>
- #include <Fonts.h>
- #include <Resources.h>
- #include <LowMem.h>
- #include <DriverServices.h>
- #include <Interrupts.h>
- #include <SCSI.h>
- #if defined(powerc) || defined (__powerc) //** TEMP
-
- #if USE_LOG_LIBRARY
- #include "LogLibrary.h"
- #endif
-
- /*
- * Include the public header files and the NCR-specific headers.
- */
- #include "NCRDriver.h"
- #include "NCR53C825.h"
-
- /*
- * The UNUSED macro replaces #pragma unused (x)
- */
- #define UNUSED(what) do { what = what; } while (0)
-
- /*
- * kIOBusyStatus is returned to the Device Manager if an asynchronous I/O
- * request is pending.
- */
- enum {
- kIOBusyStatus = 1
- };
-
- /*
- * These are private OSErr values that are passed to the Secondary Interrupt
- * handler to start or continue I/O
- */
- enum {
- kIORequestStart = +1000, /* DoDriverIO -> Start NCR device */
- kPrepareMemoryStartTask, /* Primary Interrupt -> PrepMemory Task */
- kPrepareMemoryRestart, /* PrepMemory Task -> Restart NCR device */
- kBusResetRestart /* BusReset interim interrupt -> Delay */
- };
-
- /*
- * Defined PBControl csCodes. Note that we don't support all of these.
- */
- enum {
- kControlGoodbye = (-1), /* Last call before close (ignored) */
- kControlKillIO = 1, /* This is handled by the Driver Manager */
- kControlVerifyDisk = 5, /* Verify disk */
- kControlFormatDisk = 6, /* Format disk */
- kControlEjectDisk = 7, /* Eject disk (ejectable media only) */
- kControlPhysicalIcon = 21, /* Return physical icon and where string */
- kControlMediaIcon = 22, /* Return media icon */
- kControlDriveInfo = 23, /* Return drive info */
- kControlPartitionSize = 24 /* SCSI partition size */
- };
-
- /*
- * Defined PBStatus csCodes..
- */
- enum {
- kStatusDriveStatus = 8 /* Drive status -- currently unused */
- };
- /*
- * Defined Driver Gestalt selectors.
- */
- #pragma options align=mac68k
- #endif
- /*
- * This is a temporary inclusion until driver gestalts are added to the system headers.
- */
- #include "TempDriverGestalt.h"
- #if defined(powerc) || defined(__powerc) //** TEMP
- #pragma options align=reset
- #endif
- enum {
- /*
- * Power management
- */
- kDriverGestaltPowerSwitch = 'ptog', /* Support Power up/down switching? */
- kDriverGestaltPowerMode = 'psta', /* TRUE if in high-power mode */
- kDriverGestalt5MaxHighPower = 'pmx5', /* Max 5 volt uAmps in high-power mode */
- kDriverGestalt5MaxLowPower = 'pmn5', /* Max 5 volt uAmps in low-power mode */
- kDriverGestalt3MaxHighPower = 'pmx3', /* Max 3 volt uAmps in high-power mode */
- kDriverGestalt3MaxLowPower = 'pmn3' /* Max 3 volt uAmps in low-power mode */
- };
-
- /*
- * SCSI command status (from status phase). Before returning final status, the
- * driver checks that the command status is "good" (zero) -- otherwise, if no
- * other errors are detected, it returns scsiNonZeroStatus.
- */
- enum {
- kScsiCommandStatusGood = 0x00, /* Normal completion */
- kScsiCommandStatusCheckCondition = 0x02, /* Need GetExtendedStatus */
- kScsiCommandStatusConditionMet = 0x04,
- kScsiCommandStatusBusy = 0x08, /* Device busy (self-test?) */
- kScsiCommandStatusIntermediate = 0x10, /* Intermediate status */
- kScsiStatusResConflict = 0x18, /* Reservation conflict */
- kScsiStatusQueueFull = 0x28, /* Target can't do command */
- kScsiStatusReservedMask = 0x3e /* Vendor specific? */
- };
-
- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * Our global storage is defined by this structure. This is not a requirement of the
- * driver environment, but it collects globals into a coherent structure for debugging.
- */
- #pragma options align=power
- struct DriverGlobal {
- /*
- * When we support concurrent I/O, we will need several of these.
- * The perRequestRecord is defined in NCR53C825.h
- */
- PerRequestDataPtr perRequestDataPtr; /* Script communication area */
- /*
- * DriverRefNum and RegEntryID are passed to us by the driver initialize command.
- */
- DriverRefNum refNum; /* Driver refNum for PB... */
- RegEntryID deviceEntry; /* Name Registry Entry ID */
- /*
- * GetPCICardBaseAddress initialzes pciCardBaseAddress when the driver starts.
- * this is a logical address that will be used to access the NCR card registers.
- */
- LogicalAddress pciCardBaseAddress; /* To access NCR registers */
- /*
- * Interrupt Set globals.
- */
- InterruptSetMember interruptSetMember; /* Interrupt set identifier */
- void *interruptSetRefcon; /* Existing refCon */
- InterruptHandler interruptServiceFunction; /* -> old isr function */
- InterruptEnabler interruptEnableFunction; /* -> interrupt enabler */
- InterruptDisabler interruptDisableFunction; /* -> interrupt disabler */
- /*
- * PrepareMemoryForIO globals:
- * pageSize Size of the system's physical page (== 4096)
- * pageMask Mask to get the offset within this page.
- */
- UInt32 pageSize; /* GetLogicalPageSize() */
- UInt32 pageMask; /* pageSize - 1 */
- /*
- * We need to stall 12 PCI clock ticks between some NCR register reads.
- */
- AbsoluteTime clockTick12; /* for DelayForHardware */
- AbsoluteTime msec250; /* for Bus Reset delay */
- /*
- * Information retrieved from the System Registry
- */
- UInt8 initiatorID; /* SCSI Bus ID */
- Boolean initiatorIsInNVRAM; /* Fetched from NVRAM? */
- /*
- * Script patching variables. The script is prepared when the driver is
- * initialized. Preparation determines the physical addresses of the scripts.
- * GLOBAL.scriptIOTable is prepared when the driver is opened, and checkpointen
- * when the driver is closed.
- */
- IOPreparationTable scriptIOTable; /* Prepare for the script */
- #if USE_LOG_LIBRARY
- OSType logIdentifier; /* Who am I (the refNum) */
- LogRecordPtr logRecordPtr; /* Logging driver reference */
- #endif
- /*
- * These are only needed for debugging.
- */
- UInt32 *ncrSCSIScript; /* Our SCSI script */
- ByteCount ncrSCSIScriptSize; /* Script size in bytes */
- };
- typedef struct DriverGlobal DriverGlobal, *DriverGlobalPtr;
- #pragma options align=reset
-
- #if TEST_DRIVER == 0
- /*
- * Globals and functions
- */
- extern DriverGlobal gDriverGlobal; /* All interesting globals */
- #define GLOBAL (gDriverGlobal) /* GLOBAL.field for references */
- extern DriverDescription TheDriverDescription; /* Exported to the universe */
- extern UInt32 gNCRSCSIScript[]; /* Our SCSI script */
- extern ByteCount gNCRSCSIScriptSize; /* Script size in bytes */
-
- #include "NCRDriverPrototypes.h"
-
- #endif /* If not TEST_DRIVER */
- #endif /* If not REZ */
- #endif /* __NCRSCSIDriverPrivate__ */
-
-